spectrum_diff Module


Uses


Interfaces

public interface finite_difference

  • private pure function finite_difference_1(dt, x) result(rst)

    Estimates the derivative of a data set by means of a naive implementation of a finite difference scheme based upon central differences.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: dt

    The time step between data points.

    real(kind=real64), intent(in), dimension(:) :: x

    An N-element array containing the data whose derivative is to be estimated.

    Return Value real(kind=real64), allocatable, dimension(:)

    An N-element array containing the derivative estimate.

  • private pure function finite_difference_2(t, x) result(rst)

    Computes an estimate to the derivative of an evenly-sampled data set using total variation regularization.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in), dimension(:) :: t

    An N-element array containing the time points at which x was sampled.

    real(kind=real64), intent(in), dimension(:) :: x

    An N-element array containing the data whose derivative is to be estimated.

    Return Value real(kind=real64), allocatable, dimension(:)

    An N-element array containing the derivative estimate.


Functions

public pure function filter_diff(dt, x, fc) result(rst)

Estimates the derivative of a signal by utilization of a second-order system as a filter.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: dt

The time step between data points.

real(kind=real64), intent(in), dimension(:) :: x

An N-element array containing the data whose derivative is to be estimated.

real(kind=real64), intent(in) :: fc

The filter cutoff frequency, in Hz.

Return Value real(kind=real64), allocatable, dimension(:,:)

An N-element array containing the filtered signal in the first column and the derivative estimate in the second.

public pure function stencil_diff_5(dt, x) result(rst)

Utilizes a 5-point stencil to estimate the derivative of a data set.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: dt

The time step between data points.

real(kind=real64), intent(in), dimension(:) :: x

An N-element array containing the data whose derivative is to be estimated.

Return Value real(kind=real64), allocatable, dimension(:)

An N-element array containing the derivative estimate.

public pure function stencil_second_diff_5(dt, x) result(rst)

Utilizes a 5-point stencil to estimate the second derivative of a data set.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: dt

The time step between data points.

real(kind=real64), intent(in), dimension(:) :: x

An N-element array containing the data whose derivative is to be estimated.

Return Value real(kind=real64), allocatable, dimension(:)

An N-element array containing the derivative estimate.

public function tvr_derivative(dt, x, alpha, maxiter, tol, use_sparse, niter) result(rst)

Computes an estimate to the derivative of an evenly-sampled data set using total variation regularization.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: dt

The time step between data points.

real(kind=real64), intent(in), dimension(:) :: x

An N-element array containing the data whose derivative is to be estimated.

real(kind=real64), intent(in) :: alpha

The regularization parameter.

integer(kind=int32), intent(in), optional :: maxiter

The maximum number of iterations to allow. The default is 20 iterations.

real(kind=real64), intent(in), optional :: tol

The convergence tolerance to use. The tolerance is applied to the change in the update measure. The dense solver uses an absolute Euclidean norm, while the sparse solver uses a relative Euclidean norm. The default is 1e-3.

logical, intent(in), optional :: use_sparse

True if the sparse solver should be used vs. the dense solver. This is highly recommended when N is larger than ~1000. The default is true such that the sparse solver is used. The sparse solver has linear storage growth and is preferred for large data sets.

integer(kind=int32), intent(out), optional :: niter

The number of iterations actually performed.

Return Value real(kind=real64), allocatable, dimension(:)

An N-element array containing the estimate of the derivative.